package com.yeheng.service;


import com.github.pagehelper.PageHelper;
import com.yeheng.dto.Condition;
import com.yeheng.entity.Emp;
import com.yeheng.mapper.EmpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Classname EmpService
 * @Description :
 * @Date 2020/12/26 12:55
 * @Created by Yeheng
 */
@Service
public class EmpService {
    @Autowired
    EmpMapper mapper;


    public List<Emp> findAll(Condition cond){
        PageHelper.startPage(cond.getPage(),cond.getLimit());
        List<Emp> all =mapper.findAll(cond);
        return all;
    }

    public Integer count(Condition condition){
        return mapper.count(condition);
    }

    public Emp findByEid(Integer eid){
        return mapper.findByEid(eid);
    }

    public boolean delByEid(Integer eid){
        return mapper.delByEid(eid);
    }

    public boolean updateEmp(Emp emp){
        return mapper.updateEmp(emp);
    }

    public boolean addEmp(Emp emp){
        return mapper.addEmp(emp);
    }
}
